//
//  BaseViewController.m
//  OtherDemo
//
//  Created by lianjie on 2018/7/23.
//  Copyright © 2018年 lianjie. All rights reserved.
//

#import "BaseViewController.h"

#import "AFNetworkActivityIndicatorManager.h"
@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = WhiteColor;
    
//    self.navigationItem.title = @"";
    UITableView.appearance.estimatedRowHeight = 0;
    UITableView.appearance.estimatedSectionFooterHeight = 0;
    UITableView.appearance.estimatedSectionHeaderHeight = 0;
}




///tableView下移问题
-(void) setScrollViewQuestion:(UIScrollView *)scrollView
{
    if (@available(iOS 11.0, *)) {
        scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }else{
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
}



#pragma mark -- 检测网络状态2（AF自带）
-(void)checkNetworkAvailable:(void(^)(BOOL hasNet))netBlock{
    
    // 电池条显示网络活动
    [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
    //开始监听网络
    [[AFNetworkReachabilityManager sharedManager] startMonitoring];
    [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
        switch (status)
        {
            case AFNetworkReachabilityStatusReachableViaWWAN:
                NSLog(@"当前网络为WAN");
                break;
            case AFNetworkReachabilityStatusReachableViaWiFi:
                NSLog(@"当前网络为WiFi");
                break;
            case AFNetworkReachabilityStatusNotReachable:
                NSLog(@"没有网络！");
                break;
            case AFNetworkReachabilityStatusUnknown:
                NSLog(@"当前网络为未知网络！");
                break;
            default:
                break;
        }
        if(status ==AFNetworkReachabilityStatusReachableViaWiFi || status ==AFNetworkReachabilityStatusReachableViaWWAN){
            netBlock(YES);
            //            showNetworkStatus(YES);
        }else{
            netBlock(NO);
            //            showNetworkStatus(NO);
        }
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
